package actionHandlers;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import palette.CanvasManager;
import palette.CanvasWindow;

public class PaintTimer implements ActionListener{

	private static final long serialVersionUID = -8719655025156071827L;
	private Timer time;
	
	public PaintTimer(int delay)
	{
		time = new Timer(delay, this);
	}
	
	public void actionPerformed(ActionEvent e) {
		((CanvasWindow)CanvasManager.getInst().getSelectedFrame()).getCanvas().repaint();
	}
	
	public void start()
	{
		time.start();
	}
	
	public void stop()
	{
		time.stop();
		((CanvasWindow)CanvasManager.getInst().getSelectedFrame()).getCanvas().repaint();
	}
}
